package com.easy.tool.utils.other;

import com.easy.tool.anno.BeanDes;
import com.easy.tool.anno.MethodDes;

/**
 * @author 高俊
 * @create 2021-08-2021/8/27-9:58
 */
@BeanDes(name = "其他工具类")
public class OtherUtils {
    /**
     * 判断奇偶
     * @param param
     * @return  1：奇数；2：偶数
     */
    @MethodDes(des = "判断奇偶",param = {"arg0-> param：需要判断奇偶的数值"})
    public static int checkParity(int param){
        int i = 2;
        if (param % i == 0){
            return 2;
        }
        return 1;
    }

    /**
     * 交换两个数的值
     * @param a
     * @param b
     * @return 一个数组
     */
    @MethodDes(des = "交换两个数的值",param = {"arg0-> a：数值1","arg1-> b：数值2"})
    public static int[] swapVal(int a,int b){
        int[] val = new int[2];
        a = a^b;

        b = a^b;
        a = a^b;

        val[0] = a;
        val[1] = b;
        return val;
    }
}
